package com.wss.common.context.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

/**
 * @author 赵飞
 * @version V1.0
 * @Title:
 * @Package com.zippo.common.util
 * @Description:
 * @date 2017/8/22
 */
public class DateUtil {

	/**
	 * 获取距今 day 的时间
	 */
	public static Date getLastOrNextDate(int day){
		Calendar calendar = Calendar.getInstance();
		calendar.add(Calendar.DAY_OF_MONTH,day);
		return calendar.getTime();
	}

	//获取本星期一的时间字符串
	public static String getMonday(){
		SimpleDateFormat fmt=new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
		Calendar calendar=Calendar.getInstance(Locale.CHINA);
		calendar.setFirstDayOfWeek(Calendar.MONDAY);
		calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
		return fmt.format(calendar.getTime());

	}
}
